package com.web;

import com.pojo.LunBo_db;
import com.service.LunBoService_db;
import com.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/lunbo")
public class LunBoController_db {

    @Autowired
    private LunBoService_db lunBoServiceDb;

    @RequestMapping("/show")
    public ResultEntity list(Integer del){
        return ResultEntity.ok(lunBoServiceDb.list(del));
    }

    @RequestMapping("/all")
    public ResultEntity listAll(){
        return ResultEntity.ok(lunBoServiceDb.listAll());
    }

    @RequestMapping("/findid")
    public ResultEntity findById(Integer lId){
        return ResultEntity.ok(lunBoServiceDb.findById(lId));
    }

    @RequestMapping("/finddel")
    public ResultEntity findByDel(Integer del){
        return ResultEntity.ok(lunBoServiceDb.findByDel(del));
    }

    @RequestMapping("/add")
    public ResultEntity add(LunBo_db lunBoDb){
        return ResultEntity.ok(lunBoServiceDb.add(lunBoDb.getLPhoto(), lunBoDb.getLDel()));
    }

    @RequestMapping("/update")
    public ResultEntity update(LunBo_db lunBoDb){
        return ResultEntity.ok(lunBoServiceDb.update(lunBoDb));
    }

    @RequestMapping("/delete")
    public ResultEntity delete(Integer lId){
        return ResultEntity.ok(lunBoServiceDb.del(lId));
    }
}
